public class Demo5 {
    public static void main(String[] args) throws InterruptedException {
        long start=System.currentTimeMillis();  //获取线程开始时间
        Thread.sleep(2000);  //休眠2000ms
        long end=System.currentTimeMillis();
        System.out.println("线程运行时间:"+(end-start));

    }
}
